package com.yzq.manager.WebSocket.model;

import lombok.Getter;

/**
 * 图片编辑动作枚举
 */
@Getter
public enum PictureEditActionEnum {

    UPLOAD("上传图片", "UPLOAD"),
    CROP("裁剪图片", "CROP"),
    ROTATE("旋转图片", "ROTATE"),
    FLIP("翻转图片", "FLIP"),
    MOVE("移动元素", "MOVE"),
    ADD_ELEMENT("添加元素", "ADD_ELEMENT"),
    FILTER("滤镜效果调整", "FILTER"),
    UNDO("回退", "UNDO"),
    REDO("前进", "REDO"),
    UPDATE("更新元素", "UPDATE"),
    SCALE("缩放元素", "SCALE"),
    DELETE("删除元素", "DELETE");

    private final String text;
    private final String value;

    PictureEditActionEnum(String text, String value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 根据 value 获取枚举
     */
    public static PictureEditActionEnum getEnumByValue(String value) {
        if (value == null || value.isEmpty()) {
            return null;
        }
        for (PictureEditActionEnum actionEnum : PictureEditActionEnum.values()) {
            if (actionEnum.value.equals(value)) {
                return actionEnum;
            }
        }
        return null;
    }
}